﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using VK.Casemeet.Groups;

namespace VK.Casemeet.Web.ShopFront.Controls
{
    public partial class grouplist : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            RepData();
        }

        public int ShopId { get; set; }

        public int StartIndex { get; set; }

        public int EndIndex { get; set; }

        public string DisCount(string origprice, string disprice)
        {
            Single orignum = 0; Single disnum = 0;
            Single.TryParse(origprice, out orignum);
            Single.TryParse(disprice, out disnum);
            if (disnum == 0)
                return "";

            return Math.Round((disnum / orignum * 10), 1).ToString();
        }

        /// <summary>
        /// 初使化数据
        /// </summary>
        void RepData()
        {
            repgrouplist.DataSource = GroupsBLL.GetGroups(StartIndex, EndIndex, 0, ShopId);
            repgrouplist.DataBind();
        }
    }
}